🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / ui / src / commonMain / kotlin / org / meshtastic / core / ui / component / AnimatedConnectionsNavIcon.kt
Displaying Raw • Download
core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/AnimatedConnectionsNavIcon.kt 01cd54907d62cd90913d3d071b6bc240cae365ef (01cd5490) Text, 4.15 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ui.component
Tff7b72import T7ee787androidx.compose.animation.core.Animatable
Tff7b72import T7ee787androidx.compose.animation.core.LinearEasing
Tff7b72import T7ee787androidx.compose.animation.core.tween
Tff7b72import T7ee787androidx.compose.foundation.layout.Box
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.LaunchedEffect
Tff7b72import T7ee787androidx.compose.runtime.getValue
Tff7b72import T7ee787androidx.compose.runtime.mutableStateOf
Tff7b72import T7ee787androidx.compose.runtime.remember
Tff7b72import T7ee787androidx.compose.runtime.setValue
Tff7b72import T7ee787androidx.compose.ui.Modifier
Tff7b72import T7ee787androidx.compose.ui.draw.drawWithCache
Tff7b72import T7ee787androidx.compose.ui.geometry.Offset
Tff7b72import T7ee787androidx.compose.ui.graphics.BlendMode
Tff7b72import T7ee787androidx.compose.ui.graphics.Brush
Tff7b72import T7ee787androidx.compose.ui.graphics.Color
Tff7b72import T7ee787kotlinx.coroutines.flow.Flow
Tff7b72import T7ee787kotlinx.coroutines.flow.conflate
Tff7b72import T7ee787org.meshtastic.core.model.ConnectionState
Tff7b72import T7ee787org.meshtastic.core.model.DeviceType
Tff7b72import T7ee787org.meshtastic.core.model.MeshActivity
Tff7b72import T7ee787org.meshtastic.core.ui.theme.StatusColors.StatusBlue
Tff7b72import T7ee787org.meshtastic.core.ui.theme.StatusColors.StatusGreen
T8b949e/**
* A wrapper around [ConnectionsNavIcon] that adds a blinking glow effect when there is mesh activity (Send/Receive).
*/
Tf0883e@Composable
Tff7b72fun Td2a8ffAnimatedConnectionsNavIconTb4b4b4(
Te6edf3connectionStateTb4b4b4: Te6edf3ConnectionStateTb4b4b4,
Te6edf3deviceTypeTb4b4b4: Te6edf3DeviceType?Tb4b4b4,
Te6edf3meshActivityFlowTb4b4b4: Te6edf3FlowTff7b72<Te6edf3MeshActivityTff7b72>Tb4b4b4,
Te6edf3modifierTb4b4b4: Te6edf3Modifier Tff7b72= Te6edf3ModifierTb4b4b4,
Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3colorScheme Tff7b72= Te6edf3androidxTb4b4b4.Te6edf3composeTb4b4b4.Te6edf3material3Tb4b4b4.Te6edf3MaterialThemeTb4b4b4.Te6edf3colorScheme
Tff7b72var Te6edf3currentGlowColor Tff7b72by Te6edf3remember Tb4b4b4{ Te6edf3mutableStateOfTb4b4b4(Te6edf3ColorTb4b4b4.Te6edf3TransparentTb4b4b4) Tb4b4b4}
Tff7b72val Te6edf3animatedGlowAlpha Tff7b72= Te6edf3remember Tb4b4b4{ Te6edf3AnimatableTb4b4b4(T79c0ff0fTb4b4b4) Tb4b4b4}
Tff7b72val Te6edf3sendColor Tff7b72= Te6edf3colorSchemeTb4b4b4.Te6edf3StatusGreen
Tff7b72val Te6edf3receiveColor Tff7b72= Te6edf3colorSchemeTb4b4b4.Te6edf3StatusBlue
Te6edf3LaunchedEffectTb4b4b4(Te6edf3meshActivityFlowTb4b4b4, Te6edf3colorSchemeTb4b4b4) Tb4b4b4{
Te6edf3meshActivityFlowTb4b4b4.Te6edf3conflateTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3collect Tb4b4b4{ Te6edf3activity Tff7b72-Tff7b72>
Tff7b72val Te6edf3newTargetColor Tff7b72=
Tff7b72when Tb4b4b4(Te6edf3activityTb4b4b4) Tb4b4b4{
Tff7b72is Te6edf3MeshActivityTb4b4b4.Te6edf3Send Tff7b72-Tff7b72> Te6edf3sendColor
Tff7b72is Te6edf3MeshActivityTb4b4b4.Te6edf3Receive Tff7b72-Tff7b72> Te6edf3receiveColor
Tb4b4b4}
Te6edf3currentGlowColor Tff7b72= Te6edf3newTargetColor
T8b949e// Suspend the collection until the animation finishes.
T8b949e// conflate() will drop any fast events that arrive during this 1-second animation.
Te6edf3animatedGlowAlphaTb4b4b4.Te6edf3stopTb4b4b4(Tb4b4b4)
Te6edf3animatedGlowAlphaTb4b4b4.Te6edf3snapToTb4b4b4(T79c0ff1.0fTb4b4b4)
Te6edf3animatedGlowAlphaTb4b4b4.Te6edf3animateToTb4b4b4(
Te6edf3targetValue Tff7b72= T79c0ff0.0fTb4b4b4,
Te6edf3animationSpec Tff7b72= Te6edf3tweenTb4b4b4(Te6edf3durationMillis Tff7b72= T79c0ff1T79c0ff0T79c0ff0T79c0ff0Tb4b4b4, Te6edf3easing Tff7b72= Te6edf3LinearEasingTb4b4b4)Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Te6edf3BoxTb4b4b4(
Te6edf3modifier Tff7b72=
Te6edf3modifierTb4b4b4.Te6edf3drawWithCache Tb4b4b4{
Tff7b72val Te6edf3glowRadius Tff7b72= Te6edf3sizeTb4b4b4.Te6edf3minDimension
Tff7b72val Te6edf3glowBrush Tff7b72=
Te6edf3BrushTb4b4b4.Te6edf3radialGradientTb4b4b4(
Te6edf3colors Tff7b72=
Te6edf3listOfTb4b4b4(
Te6edf3currentGlowColorTb4b4b4.Te6edf3copyTb4b4b4(Te6edf3alpha Tff7b72= T79c0ff0.8fTb4b4b4)Tb4b4b4,
Te6edf3currentGlowColorTb4b4b4.Te6edf3copyTb4b4b4(Te6edf3alpha Tff7b72= T79c0ff0.4fTb4b4b4)Tb4b4b4,
Te6edf3ColorTb4b4b4.Te6edf3TransparentTb4b4b4,
Tb4b4b4)Tb4b4b4,
Te6edf3center Tff7b72= Te6edf3OffsetTb4b4b4(Te6edf3sizeTb4b4b4.Te6edf3width Tff7b72/ T79c0ff2Tb4b4b4, Te6edf3sizeTb4b4b4.Te6edf3height Tff7b72/ T79c0ff2Tb4b4b4)Tb4b4b4,
Te6edf3radius Tff7b72= Te6edf3glowRadiusTb4b4b4,
Tb4b4b4)
Te6edf3onDrawWithContent Tb4b4b4{
Te6edf3drawContentTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3alpha Tff7b72= Te6edf3animatedGlowAlphaTb4b4b4.Te6edf3value
Tff7b72if Tb4b4b4(Te6edf3alpha Tff7b72> T79c0ff0fTb4b4b4) Tb4b4b4{
Te6edf3drawCircleTb4b4b4(Te6edf3brush Tff7b72= Te6edf3glowBrushTb4b4b4, Te6edf3radius Tff7b72= Te6edf3glowRadiusTb4b4b4, Te6edf3alpha Tff7b72= Te6edf3alphaTb4b4b4, Te6edf3blendMode Tff7b72= Te6edf3BlendModeTb4b4b4.Te6edf3ScreenTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}Tb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3ConnectionsNavIconTb4b4b4(Te6edf3connectionState Tff7b72= Te6edf3connectionStateTb4b4b4, Te6edf3deviceType Tff7b72= Te6edf3deviceTypeTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.11s